package com.xd.pre.modules.tpshop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.xd.pre.modules.tpshop.domain.TpGoods;
import com.xd.pre.modules.tpshop.mapper.TpGoodsMapper;
import com.xd.pre.modules.tpshop.service.ITpGoodsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lx
 * @since 2020-06-03
 */
@Service
public class TpGoodsServiceImpl extends ServiceImpl<TpGoodsMapper, TpGoods> implements ITpGoodsService {

    @Override
    public List<TpGoods> findgoodslist_byCategory(Integer categoryId){
        LambdaQueryWrapper<TpGoods> lambdaQuery = Wrappers.lambdaQuery();
        lambdaQuery.eq(TpGoods::getCategoryId,categoryId);
        return this.list(lambdaQuery);

    }

    @Override
    public TpGoods findGoods_bygoodsId(Integer goodsId) {
        return getById(goodsId);
    }

}
